package com.tianqu.tms.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.dto.TmsDetectSeniorDto;

public class TmsDetectSeniorDaoImp extends TmsDao  implements TmsDetectSeniorDao{

	protected TmsDetectSeniorDaoImp() throws TmsDaoException {
		super();
	}

	/**
	 * 删除车辆检测信息
	 */
	@Override
	public void delDetectSenior(int id) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("DELETE FROM  ");
			sql.append(TmsTableNames.TMS_DETECT_SENIOR);
			sql.append(" WHERE  ");
			sql.append(" ID=?  ");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, id);
			ps.executeUpdate();	
			
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 
	 * 新增一条高级检测信息
	 * 
	 * 返回主键ID(检测ID)
	 * @throws TmsDaoException 
	 */
	@Override
	public int insertCarSeniorDetectInfo(TmsDetectSeniorDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		int carDetectId = 0;
		try { 
			
			StringBuffer sql = new StringBuffer("INSERT INTO  ");
			sql.append(TmsTableNames.TMS_DETECT_SENIOR);
			sql.append(" (  ");
			sql.append("  BODYCHK1,  	");
			sql.append("  BODYCHK2,  	");
			sql.append("  BODYCHK3,  	");
			sql.append("  BODYCHK4,  	");
			sql.append("  BODYCHK5,  	");
			sql.append("  BODYCHK6,  	");
			sql.append("  BODYCHK7,  	");
			sql.append("  BODYCHK8,  	");
			sql.append("  BODYCHK9,  	");
			sql.append("  BODYCHK10,  	");
			sql.append("  BODYCHK11,  	");
			sql.append("  BODYCHK12,  	");
			sql.append("  BODYCHK13,  	");
			sql.append("  OUTWARDCHK1,  ");
			sql.append("  OUTWARDCHK2,  ");
			sql.append("  OUTWARDCHK3,  ");
			sql.append("  OUTWARDCHK4,  ");
			sql.append("  OUTWARDCHK5,  ");
			sql.append("  OUTWARDCHK6,  ");
			sql.append("  OUTWARDCHK7,  ");
			sql.append("  OUTWARDCHK8,  ");
			sql.append("  OUTWARDCHK9,  ");
			sql.append("  OUTWARDCHK10, ");
			sql.append("  OUTWARDCHK11, ");
			sql.append("  OUTWARDCHK12, ");
			sql.append("  OUTWARDCHK13, ");
			sql.append("  OUTWARDCHK14, ");
			sql.append("  OUTWARDCHK15, ");
			sql.append("  OUTWARDCHK16, ");
			sql.append("  OUTWARDCHK17, ");
			sql.append("  OUTWARDCHK18, ");
			sql.append("  OUTWARDCHK19, ");
			sql.append("  OUTWARDCHK20, ");
			sql.append("  OUTWARDCHK21, ");
			sql.append("  OUTWARDCHK22, ");
			sql.append("  OUTWARDCHK23, ");
			sql.append("  OUTWARDCHK25, ");
			sql.append("  OUTWARDCHK26, ");
			sql.append("  OUTWARDCHK27, ");
			sql.append("  ENGINECHK1,  	");
			sql.append("  ENGINECHK2,  	");
			sql.append("  ENGINECHK3,  	");
			sql.append("  ENGINECHK4,  	");
			sql.append("  ENGINECHK5,  	");
			sql.append("  ENGINECHK6,  	");
			sql.append("  ENGINECHK7,  	");
			sql.append("  ENGINECHK8,  	");
			sql.append("  ENGINECHK9,  	");
			sql.append("  PILOTCHK1,  	");
			sql.append("  PILOTCHK2,  	");
			sql.append("  PILOTCHK3,  	");
			sql.append("  PILOTCHK4,  	");
			sql.append("  PILOTCHK5,  	");
			sql.append("  PILOTCHK6,  	");
			sql.append("  PILOTCHK7,  	");
			sql.append("  PILOTCHK8,  	");
			sql.append("  PILOTCHK9,  	");
			sql.append("  PILOTCHK10,  	");
			sql.append("  PILOTCHK11,  	");
			sql.append("  PILOTCHK12,  	");
			sql.append("  PILOTCHK13,  	");
			sql.append("  PILOTCHK14,  	");
			sql.append("  STARTCHK1,  	");
			sql.append("  STARTCHK2,  	");
			sql.append("  STARTCHK3,  	");
			sql.append("  STARTCHK4,  	");
			sql.append("  STARTCHK5,  	");
			sql.append("  STARTCHK6,  	");
			sql.append("  STARTCHK7,  	");
			sql.append("  STARTCHK8,  	");
			sql.append("  STARTCHK9,  	");
			sql.append("  RUNCHK1,  	");
			sql.append("  RUNCHK2,  	");
			sql.append("  RUNCHK3,  	");
			sql.append("  RUNCHK4,  	");
			sql.append("  RUNCHK5,  	");
			sql.append("  RUNCHK6,  	");
			sql.append("  RUNCHK7,  	");
			sql.append("  RUNCHK8,  	");
			sql.append("  RUNCHK9,  	");
			sql.append("  BOTTOMCHK1,  	");
			sql.append("  BOTTOMCHK2,  	");
			sql.append("  BOTTOMCHK3,  	");
			sql.append("  BOTTOMCHK4,  	");
			sql.append("  BOTTOMCHK5,  	");
			sql.append("  BOTTOMCHK6,  	");
			sql.append("  BOTTOMCHK7,  	");
			sql.append("  OUTWARDSCORE, ");
			sql.append("  ENGINESCORE,  ");
			sql.append("  PILOTSCORE,  	");
			sql.append("  STARTSCORE,  	");
			sql.append("  RUNSCORE,  	");
			sql.append("  BOTTOMSCORE  	");
			sql.append("  )  ");
			sql.append("  VALUES ");
			sql.append(" (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
			sql.append(" ,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
			sql.append(" ,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?");
			sql.append(" ,?,?,?) ");//93项
			
			ps = conn.prepareStatement(sql.toString());
			/********事故项检查************/
			ps.setString(1, dto.getBodyChk1());
			ps.setString(2, dto.getBodyChk2());
			ps.setString(3, dto.getBodyChk3());
			ps.setString(4, dto.getBodyChk4());
			ps.setString(5, dto.getBodyChk5());
			ps.setString(6, dto.getBodyChk6());
			ps.setString(7, dto.getBodyChk7());
			ps.setString(8, dto.getBodyChk8());
			ps.setString(9, dto.getBodyChk9());
			ps.setString(10, dto.getBodyChk10());
			ps.setString(11, dto.getBodyChk11());
			ps.setString(12, dto.getBodyChk12());
			ps.setString(13, dto.getBodyChk13());
			/***********技术检测，车身外观检测***************/
			ps.setString(14, dto.getOutwardChk1());
			ps.setString(15, dto.getOutwardChk2());
			ps.setString(16, dto.getOutwardChk3());
			ps.setString(17, dto.getOutwardChk4());
			ps.setString(18, dto.getOutwardChk5());
			ps.setString(19, dto.getOutwardChk6());
			ps.setString(20, dto.getOutwardChk7());
			ps.setString(21, dto.getOutwardChk8());
			ps.setString(22, dto.getOutwardChk9());
			ps.setString(23, dto.getOutwardChk10());
			ps.setString(24, dto.getOutwardChk11());
			ps.setString(25, dto.getOutwardChk12());
			ps.setString(26, dto.getOutwardChk13());
			ps.setString(27, dto.getOutwardChk14());
			ps.setString(28, dto.getOutwardChk15());
			ps.setString(29, dto.getOutwardChk16());
			ps.setString(30, dto.getOutwardChk17());
			ps.setString(31, dto.getOutwardChk18());
			ps.setString(32, dto.getOutwardChk19());
			ps.setString(33, dto.getOutwardChk20());
			ps.setString(34, dto.getOutwardChk21());
			ps.setString(35, dto.getOutwardChk22());
			ps.setString(36, dto.getOutwardChk23());
			ps.setString(37, dto.getOutwardChk25());
			ps.setString(38, dto.getOutwardChk26());
			ps.setString(39, dto.getOutwardChk27());
			/***********技术检测，发动机舱检测***************/
			ps.setInt(40, dto.getEngineChk1());
			ps.setInt(41, dto.getEngineChk2());
			ps.setInt(42, dto.getEngineChk3());
			ps.setInt(43, dto.getEngineChk4());
			ps.setInt(44, dto.getEngineChk5());
			ps.setInt(45, dto.getEngineChk6());
			ps.setInt(46, dto.getEngineChk7());
			ps.setInt(47, dto.getEngineChk8());
			ps.setInt(48, dto.getEngineChk9());
			/***********技术检测，驾驶舱检测***************/
			ps.setInt(49, dto.getPilotChk1());
			ps.setInt(50, dto.getPilotChk2());
			ps.setInt(51, dto.getPilotChk3());
			ps.setInt(52, dto.getPilotChk4());
			ps.setInt(53, dto.getPilotChk5());
			ps.setInt(54, dto.getPilotChk6());
			ps.setInt(55, dto.getPilotChk7());
			ps.setInt(56, dto.getPilotChk8());
			ps.setInt(57, dto.getPilotChk9());
			ps.setInt(58, dto.getPilotChk10());
			ps.setInt(59, dto.getPilotChk11());
			ps.setInt(60, dto.getPilotChk12());
			ps.setInt(61, dto.getPilotChk13());
			ps.setInt(62, dto.getPilotChk14());
			/***********技术检测，启动检测***************/
			ps.setInt(63, dto.getStartChk1());
			ps.setInt(64, dto.getStartChk2());
			ps.setInt(65, dto.getStartChk3());
			ps.setInt(66, dto.getStartChk4());
			ps.setInt(67, dto.getStartChk5());
			ps.setInt(68, dto.getStartChk6());
			ps.setInt(69, dto.getStartChk7());
			ps.setInt(70, dto.getStartChk8());
			ps.setInt(71, dto.getStartChk9());
			/***********技术检测，路试检测***************/
			ps.setInt(72, dto.getRunChk1());
			ps.setInt(73, dto.getRunChk2());
			ps.setInt(74, dto.getRunChk3());
			ps.setInt(75, dto.getRunChk4());
			ps.setInt(76, dto.getRunChk5());
			ps.setInt(77, dto.getRunChk6());
			ps.setInt(78, dto.getRunChk7());
			ps.setInt(79, dto.getRunChk8());
			ps.setInt(80, dto.getRunChk9());
			/***********技术检测，底盘检测***************/
			ps.setInt(81, dto.getBottomChk1());
			ps.setInt(82, dto.getBottomChk2());
			ps.setInt(83, dto.getBottomChk3());
			ps.setInt(84, dto.getBottomChk4());
			ps.setInt(85, dto.getBottomChk5());
			ps.setInt(86, dto.getBottomChk6());
			ps.setInt(87, dto.getBottomChk7());
			/**********评分*****************/
			ps.setInt(88, (int)dto.getOutwardScore());
			ps.setInt(89, (int)dto.getEngineScore());
			ps.setInt(90, (int)dto.getPilotScore());
			ps.setInt(91, (int)dto.getStartScore());
			ps.setInt(92, (int)dto.getRunScore());
			ps.setInt(93, (int)dto.getBottomScore());
			
	        ps.executeUpdate();	
			
			rs = ps.getGeneratedKeys();
			rs.next();
			carDetectId = rs.getInt(1);
		} catch (SQLException e) {
               e.printStackTrace();
			//			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return carDetectId;				
	}
	/**
	 * 
	 * 根据检测ID查询出车辆高级检测信息
	 * @throws TmsDaoException 
	 */
	@Override
	public TmsDetectSeniorDto findCarSeniorDetectInfoById(int id) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		TmsDetectSeniorDto dto = null;
		try {
			conn = super.getConnection();

			StringBuffer sql = new StringBuffer();
			sql.append("  SELECT     	");
			sql.append("  ID,  	");
			sql.append("  BODYCHK1,  	");
			sql.append("  BODYCHK2,  	");
			sql.append("  BODYCHK3,  	");
			sql.append("  BODYCHK4,  	");
			sql.append("  BODYCHK5,  	");
			sql.append("  BODYCHK6,  	");
			sql.append("  BODYCHK7,  	");
			sql.append("  BODYCHK8,  	");
			sql.append("  BODYCHK9,  	");
			sql.append("  BODYCHK10,  	");
			sql.append("  BODYCHK11,  	");
			sql.append("  BODYCHK12,  	");
			sql.append("  BODYCHK13,  	");
			sql.append("  OUTWARDCHK1,  ");
			sql.append("  OUTWARDCHK2,  ");
			sql.append("  OUTWARDCHK3,  ");
			sql.append("  OUTWARDCHK4,  ");
			sql.append("  OUTWARDCHK5,  ");
			sql.append("  OUTWARDCHK6,  ");
			sql.append("  OUTWARDCHK7,  ");
			sql.append("  OUTWARDCHK8,  ");
			sql.append("  OUTWARDCHK9,  ");
			sql.append("  OUTWARDCHK10, ");
			sql.append("  OUTWARDCHK11, ");
			sql.append("  OUTWARDCHK12, ");
			sql.append("  OUTWARDCHK13, ");
			sql.append("  OUTWARDCHK14, ");
			sql.append("  OUTWARDCHK15, ");
			sql.append("  OUTWARDCHK16, ");
			sql.append("  OUTWARDCHK17, ");
			sql.append("  OUTWARDCHK18, ");
			sql.append("  OUTWARDCHK19, ");
			sql.append("  OUTWARDCHK20, ");
			sql.append("  OUTWARDCHK21, ");
			sql.append("  OUTWARDCHK22, ");
			sql.append("  OUTWARDCHK23, ");
			sql.append("  OUTWARDCHK25, ");
			sql.append("  OUTWARDCHK26, ");
			sql.append("  OUTWARDCHK27, ");
			sql.append("  ENGINECHK1,  	");
			sql.append("  ENGINECHK2,  	");
			sql.append("  ENGINECHK3,  	");
			sql.append("  ENGINECHK4,  	");
			sql.append("  ENGINECHK5,  	");
			sql.append("  ENGINECHK6,  	");
			sql.append("  ENGINECHK7,  	");
			sql.append("  ENGINECHK8,  	");
			sql.append("  ENGINECHK9,  	");
			sql.append("  PILOTCHK1,  	");
			sql.append("  PILOTCHK2,  	");
			sql.append("  PILOTCHK3,  	");
			sql.append("  PILOTCHK4,  	");
			sql.append("  PILOTCHK5,  	");
			sql.append("  PILOTCHK6,  	");
			sql.append("  PILOTCHK7,  	");
			sql.append("  PILOTCHK8,  	");
			sql.append("  PILOTCHK9,  	");
			sql.append("  PILOTCHK10,  	");
			sql.append("  PILOTCHK11,  	");
			sql.append("  PILOTCHK12,  	");
			sql.append("  PILOTCHK13,  	");
			sql.append("  PILOTCHK14,  	");
			sql.append("  STARTCHK1,  	");
			sql.append("  STARTCHK2,  	");
			sql.append("  STARTCHK3,  	");
			sql.append("  STARTCHK4,  	");
			sql.append("  STARTCHK5,  	");
			sql.append("  STARTCHK6,  	");
			sql.append("  STARTCHK7,  	");
			sql.append("  STARTCHK8,  	");
			sql.append("  STARTCHK9,  	");
			sql.append("  RUNCHK1,  	");
			sql.append("  RUNCHK2,  	");
			sql.append("  RUNCHK3,  	");
			sql.append("  RUNCHK4,  	");
			sql.append("  RUNCHK5,  	");
			sql.append("  RUNCHK6,  	");
			sql.append("  RUNCHK7,  	");
			sql.append("  RUNCHK8,  	");
			sql.append("  RUNCHK9,  	");
			sql.append("  BOTTOMCHK1,  	");
			sql.append("  BOTTOMCHK2,  	");
			sql.append("  BOTTOMCHK3,  	");
			sql.append("  BOTTOMCHK4,  	");
			sql.append("  BOTTOMCHK5,  	");
			sql.append("  BOTTOMCHK6,  	");
			sql.append("  BOTTOMCHK7,  	");
			sql.append("  OUTWARDSCORE, ");
			sql.append("  ENGINESCORE,  ");
			sql.append("  PILOTSCORE,  	");
			sql.append("  STARTSCORE,  	");
			sql.append("  RUNSCORE,  	");
			sql.append("  BOTTOMSCORE  	");
			sql.append("  FROM   	 	");
			sql.append(TmsTableNames.TMS_DETECT_SENIOR);
			sql.append("    WHERE  id=? ");

			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, id);

			// 执行sql
			rs = ps.executeQuery();

			while (rs.next()) {
				dto = new TmsDetectSeniorDto();
				dto.setBodyChk1(rs.getString("ID"));
				dto.setBodyChk1(rs.getString("BODYCHK1"));
				dto.setBodyChk2(rs.getString("BODYCHK2"));
				dto.setBodyChk3(rs.getString("BODYCHK3"));
				dto.setBodyChk4(rs.getString("BODYCHK4"));
				dto.setBodyChk5(rs.getString("BODYCHK5"));
				dto.setBodyChk6(rs.getString("BODYCHK6"));
				dto.setBodyChk7(rs.getString("BODYCHK7"));
				dto.setBodyChk8(rs.getString("BODYCHK8"));
				dto.setBodyChk9(rs.getString("BODYCHK9"));
				dto.setBodyChk10(rs.getString("BODYCHK10"));
				dto.setBodyChk11(rs.getString("BODYCHK11"));
				dto.setBodyChk12(rs.getString("BODYCHK12"));
				dto.setBodyChk13(rs.getString("BODYCHK13"));
				dto.setOutwardChk1(rs.getString("OUTWARDCHK1"));
				dto.setOutwardChk2(rs.getString("OUTWARDCHK2"));
				dto.setOutwardChk3(rs.getString("OUTWARDCHK3"));
				dto.setOutwardChk4(rs.getString("OUTWARDCHK4"));
				dto.setOutwardChk5(rs.getString("OUTWARDCHK5"));
				dto.setOutwardChk6(rs.getString("OUTWARDCHK6"));
				dto.setOutwardChk7(rs.getString("OUTWARDCHK7"));
				dto.setOutwardChk8(rs.getString("OUTWARDCHK8"));
				dto.setOutwardChk9(rs.getString("OUTWARDCHK9"));
				dto.setOutwardChk10(rs.getString("OUTWARDCHK10"));
				dto.setOutwardChk11(rs.getString("OUTWARDCHK11"));
				dto.setOutwardChk12(rs.getString("OUTWARDCHK12"));
				dto.setOutwardChk13(rs.getString("OUTWARDCHK13"));
				dto.setOutwardChk14(rs.getString("OUTWARDCHK14"));
				dto.setOutwardChk15(rs.getString("OUTWARDCHK15"));
				dto.setOutwardChk16(rs.getString("OUTWARDCHK16"));
				dto.setOutwardChk17(rs.getString("OUTWARDCHK17"));
				dto.setOutwardChk18(rs.getString("OUTWARDCHK18"));
				dto.setOutwardChk19(rs.getString("OUTWARDCHK19"));
				dto.setOutwardChk20(rs.getString("OUTWARDCHK20"));
				dto.setOutwardChk21(rs.getString("OUTWARDCHK21"));
				dto.setOutwardChk22(rs.getString("OUTWARDCHK22"));
				dto.setOutwardChk23(rs.getString("OUTWARDCHK23"));
				dto.setOutwardChk25(rs.getString("OUTWARDCHK25"));
				dto.setOutwardChk26(rs.getString("OUTWARDCHK26"));
				dto.setOutwardChk27(rs.getString("OUTWARDCHK27"));
				dto.setEngineChk1(rs.getInt("ENGINECHK1"));
				dto.setEngineChk2(rs.getInt("ENGINECHK2"));
				dto.setEngineChk3(rs.getInt("ENGINECHK3"));
				dto.setEngineChk4(rs.getInt("ENGINECHK4"));
				dto.setEngineChk5(rs.getInt("ENGINECHK5"));
				dto.setEngineChk6(rs.getInt("ENGINECHK6"));
				dto.setEngineChk7(rs.getInt("ENGINECHK7"));
				dto.setEngineChk8(rs.getInt("ENGINECHK8"));
				dto.setEngineChk9(rs.getInt("ENGINECHK9"));
				dto.setPilotChk1(rs.getInt("PILOTCHK1"));
				dto.setPilotChk2(rs.getInt("PILOTCHK2"));
				dto.setPilotChk3(rs.getInt("PILOTCHK3"));
				dto.setPilotChk4(rs.getInt("PILOTCHK4"));
				dto.setPilotChk5(rs.getInt("PILOTCHK5"));
				dto.setPilotChk6(rs.getInt("PILOTCHK6"));
				dto.setPilotChk7(rs.getInt("PILOTCHK7"));
				dto.setPilotChk8(rs.getInt("PILOTCHK8"));
				dto.setPilotChk9(rs.getInt("PILOTCHK9"));
				dto.setPilotChk10(rs.getInt("PILOTCHK10"));
				dto.setPilotChk11(rs.getInt("PILOTCHK11"));
				dto.setPilotChk12(rs.getInt("PILOTCHK12"));
				dto.setPilotChk13(rs.getInt("PILOTCHK13"));
				dto.setPilotChk14(rs.getInt("PILOTCHK14"));
				dto.setStartChk1(rs.getInt("STARTCHK1"));
				dto.setStartChk2(rs.getInt("STARTCHK2"));
				dto.setStartChk3(rs.getInt("STARTCHK3"));
				dto.setStartChk4(rs.getInt("STARTCHK4"));
				dto.setStartChk5(rs.getInt("STARTCHK5"));
				dto.setStartChk6(rs.getInt("STARTCHK6"));
				dto.setStartChk7(rs.getInt("STARTCHK7"));
				dto.setStartChk8(rs.getInt("STARTCHK8"));
				dto.setStartChk9(rs.getInt("STARTCHK9"));
				dto.setRunChk1(rs.getInt("RUNCHK1"));
				dto.setRunChk2(rs.getInt("RUNCHK2"));
				dto.setRunChk3(rs.getInt("RUNCHK3"));
				dto.setRunChk4(rs.getInt("RUNCHK4"));
				dto.setRunChk5(rs.getInt("RUNCHK5"));
				dto.setRunChk6(rs.getInt("RUNCHK6"));
				dto.setRunChk7(rs.getInt("RUNCHK7"));
				dto.setRunChk8(rs.getInt("RUNCHK8"));
				dto.setRunChk9(rs.getInt("RUNCHK9"));
				dto.setBottomChk1(rs.getInt("BOTTOMCHK1"));
				dto.setBottomChk2(rs.getInt("BOTTOMCHK2"));
				dto.setBottomChk3(rs.getInt("BOTTOMCHK3"));
				dto.setBottomChk4(rs.getInt("BOTTOMCHK4"));
				dto.setBottomChk5(rs.getInt("BOTTOMCHK5"));
				dto.setBottomChk6(rs.getInt("BOTTOMCHK6"));
				dto.setBottomChk7(rs.getInt("BOTTOMCHK7"));
				dto.setOutwardScore(rs.getDouble("OUTWARDSCORE"));
				dto.setEngineScore(rs.getDouble("ENGINESCORE"));
				dto.setPilotScore(rs.getDouble("PILOTSCORE"));
				dto.setStartScore(rs.getDouble("STARTSCORE"));
				dto.setRunScore(rs.getDouble("RUNSCORE"));
				dto.setBottomScore(rs.getDouble("BOTTOMSCORE"));

			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}
	/**
	 * 
	 * 新增一条高级检测信息
	 * 
	 * 返回主键ID(检测ID)
	 * @throws TmsDaoException 
	 */
	@Override
	public void updateCarSeniorDetectInfo(TmsDetectSeniorDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try { 
			
			StringBuffer sql = new StringBuffer(" UPDATE  ");
			sql.append(TmsTableNames.TMS_DETECT_SENIOR);
			sql.append("  SET  ");
			sql.append("  BODYCHK1=?,      	");
			sql.append("  BODYCHK2=?,      	");
			sql.append("  BODYCHK3=?,      	");
			sql.append("  BODYCHK4=?,      	");
			sql.append("  BODYCHK5=?,      	");
			sql.append("  BODYCHK6=?,      	");
			sql.append("  BODYCHK7=?,      	");
			sql.append("  BODYCHK8=?,      	");
			sql.append("  BODYCHK9=?,      	");
			sql.append("  BODYCHK10=?,      ");
			sql.append("  BODYCHK11=?,      ");
			sql.append("  BODYCHK12=?,      ");
			sql.append("  BODYCHK13=?,      ");
			sql.append("  OUTWARDCHK1=?,    ");
			sql.append("  OUTWARDCHK2=?,    ");
			sql.append("  OUTWARDCHK3=?,    ");
			sql.append("  OUTWARDCHK4=?,    ");
			sql.append("  OUTWARDCHK5=?,    ");
			sql.append("  OUTWARDCHK6=?,    ");
			sql.append("  OUTWARDCHK7=?,    ");
			sql.append("  OUTWARDCHK8=?,    ");
			sql.append("  OUTWARDCHK9=?,    ");
			sql.append("  OUTWARDCHK10=?,   ");
			sql.append("  OUTWARDCHK11=?,   ");
			sql.append("  OUTWARDCHK12=?,   ");
			sql.append("  OUTWARDCHK13=?,   ");
			sql.append("  OUTWARDCHK14=?,   ");
			sql.append("  OUTWARDCHK15=?,   ");
			sql.append("  OUTWARDCHK16=?,   ");
			sql.append("  OUTWARDCHK17=?,   ");
			sql.append("  OUTWARDCHK18=?,   ");
			sql.append("  OUTWARDCHK19=?,   ");
			sql.append("  OUTWARDCHK20=?,   ");
			sql.append("  OUTWARDCHK21=?,   ");
			sql.append("  OUTWARDCHK22=?,   ");
			sql.append("  OUTWARDCHK23=?,   ");
			sql.append("  OUTWARDCHK25=?,   ");
			sql.append("  OUTWARDCHK26=?,   ");
			sql.append("  OUTWARDCHK27=?,   ");
			sql.append("  ENGINECHK1=?,     ");
			sql.append("  ENGINECHK2=?,     ");
			sql.append("  ENGINECHK3=?,     ");
			sql.append("  ENGINECHK4=?,     ");
			sql.append("  ENGINECHK5=?,     ");
			sql.append("  ENGINECHK6=?,     ");
			sql.append("  ENGINECHK7=?,     ");
			sql.append("  ENGINECHK8=?,     ");
			sql.append("  ENGINECHK9=?,     ");
			sql.append("  PILOTCHK1=?,      ");
			sql.append("  PILOTCHK2=?,      ");
			sql.append("  PILOTCHK3=?,      ");
			sql.append("  PILOTCHK4=?,      ");
			sql.append("  PILOTCHK5=?,      ");
			sql.append("  PILOTCHK6=?,      ");
			sql.append("  PILOTCHK7=?,      ");
			sql.append("  PILOTCHK8=?,      ");
			sql.append("  PILOTCHK9=?,      ");
			sql.append("  PILOTCHK10=?,     ");
			sql.append("  PILOTCHK11=?,     ");
			sql.append("  PILOTCHK12=?,     ");
			sql.append("  PILOTCHK13=?,     ");
			sql.append("  PILOTCHK14=?,     ");
			sql.append("  STARTCHK1=?,      ");
			sql.append("  STARTCHK2=?,      ");
			sql.append("  STARTCHK3=?,      ");
			sql.append("  STARTCHK4=?,      ");
			sql.append("  STARTCHK5=?,      ");
			sql.append("  STARTCHK6=?,      ");
			sql.append("  STARTCHK7=?,      ");
			sql.append("  STARTCHK8=?,      ");
			sql.append("  STARTCHK9=?,      ");
			sql.append("  RUNCHK1=?,      	");
			sql.append("  RUNCHK2=?,      	");
			sql.append("  RUNCHK3=?,      	");
			sql.append("  RUNCHK4=?,      	");
			sql.append("  RUNCHK5=?,      	");
			sql.append("  RUNCHK6=?,      	");
			sql.append("  RUNCHK7=?,      	");
			sql.append("  RUNCHK8=?,      	");
			sql.append("  RUNCHK9=?,      	");
			sql.append("  BOTTOMCHK1=?,     ");
			sql.append("  BOTTOMCHK2=?,     ");
			sql.append("  BOTTOMCHK3=?,     ");
			sql.append("  BOTTOMCHK4=?,     ");
			sql.append("  BOTTOMCHK5=?,     ");
			sql.append("  BOTTOMCHK6=?,     ");
			sql.append("  BOTTOMCHK7=?,     ");
			sql.append("  OUTWARDSCORE=?,   ");
			sql.append("  ENGINESCORE=?,    ");
			sql.append("  PILOTSCORE=?,     ");
			sql.append("  STARTSCORE=?,     ");
			sql.append("  RUNSCORE=?,      	");
			sql.append("  BOTTOMSCORE=?  	");
			sql.append("  WHERE ID=?  		");

			
			ps = conn.prepareStatement(sql.toString());
			/********事故项检查************/
			ps.setString(1, dto.getBodyChk1());
			ps.setString(2, dto.getBodyChk2());
			ps.setString(3, dto.getBodyChk3());
			ps.setString(4, dto.getBodyChk4());
			ps.setString(5, dto.getBodyChk5());
			ps.setString(6, dto.getBodyChk6());
			ps.setString(7, dto.getBodyChk7());
			ps.setString(8, dto.getBodyChk8());
			ps.setString(9, dto.getBodyChk9());
			ps.setString(10, dto.getBodyChk10());
			ps.setString(11, dto.getBodyChk11());
			ps.setString(12, dto.getBodyChk12());
			ps.setString(13, dto.getBodyChk13());
			/***********技术检测，车身外观检测***************/
			ps.setString(14, dto.getOutwardChk1());
			ps.setString(15, dto.getOutwardChk2());
			ps.setString(16, dto.getOutwardChk3());
			ps.setString(17, dto.getOutwardChk4());
			ps.setString(18, dto.getOutwardChk5());
			ps.setString(19, dto.getOutwardChk6());
			ps.setString(20, dto.getOutwardChk7());
			ps.setString(21, dto.getOutwardChk8());
			ps.setString(22, dto.getOutwardChk9());
			ps.setString(23, dto.getOutwardChk10());
			ps.setString(24, dto.getOutwardChk11());
			ps.setString(25, dto.getOutwardChk12());
			ps.setString(26, dto.getOutwardChk13());
			ps.setString(27, dto.getOutwardChk14());
			ps.setString(28, dto.getOutwardChk15());
			ps.setString(29, dto.getOutwardChk16());
			ps.setString(30, dto.getOutwardChk17());
			ps.setString(31, dto.getOutwardChk18());
			ps.setString(32, dto.getOutwardChk19());
			ps.setString(33, dto.getOutwardChk20());
			ps.setString(34, dto.getOutwardChk21());
			ps.setString(35, dto.getOutwardChk22());
			ps.setString(36, dto.getOutwardChk23());
			ps.setString(37, dto.getOutwardChk25());
			ps.setString(38, dto.getOutwardChk26());
			ps.setString(39, dto.getOutwardChk27());
			/***********技术检测，发动机舱检测***************/
			ps.setInt(40, dto.getEngineChk1());
			ps.setInt(41, dto.getEngineChk2());
			ps.setInt(42, dto.getEngineChk3());
			ps.setInt(43, dto.getEngineChk4());
			ps.setInt(44, dto.getEngineChk5());
			ps.setInt(45, dto.getEngineChk6());
			ps.setInt(46, dto.getEngineChk7());
			ps.setInt(47, dto.getEngineChk8());
			ps.setInt(48, dto.getEngineChk9());
			/***********技术检测，驾驶舱检测***************/
			ps.setInt(49, dto.getPilotChk1());
			ps.setInt(50, dto.getPilotChk2());
			ps.setInt(51, dto.getPilotChk3());
			ps.setInt(52, dto.getPilotChk4());
			ps.setInt(53, dto.getPilotChk5());
			ps.setInt(54, dto.getPilotChk6());
			ps.setInt(55, dto.getPilotChk7());
			ps.setInt(56, dto.getPilotChk8());
			ps.setInt(57, dto.getPilotChk9());
			ps.setInt(58, dto.getPilotChk10());
			ps.setInt(59, dto.getPilotChk11());
			ps.setInt(60, dto.getPilotChk12());
			ps.setInt(61, dto.getPilotChk13());
			ps.setInt(62, dto.getPilotChk14());
			/***********技术检测，启动检测***************/
			ps.setInt(63, dto.getStartChk1());
			ps.setInt(64, dto.getStartChk2());
			ps.setInt(65, dto.getStartChk3());
			ps.setInt(66, dto.getStartChk4());
			ps.setInt(67, dto.getStartChk5());
			ps.setInt(68, dto.getStartChk6());
			ps.setInt(69, dto.getStartChk7());
			ps.setInt(70, dto.getStartChk8());
			ps.setInt(71, dto.getStartChk9());
			/***********技术检测，路试检测***************/
			ps.setInt(72, dto.getRunChk1());
			ps.setInt(73, dto.getRunChk2());
			ps.setInt(74, dto.getRunChk3());
			ps.setInt(75, dto.getRunChk4());
			ps.setInt(76, dto.getRunChk5());
			ps.setInt(77, dto.getRunChk6());
			ps.setInt(78, dto.getRunChk7());
			ps.setInt(79, dto.getRunChk8());
			ps.setInt(80, dto.getRunChk9());
			/***********技术检测，底盘检测***************/
			ps.setInt(81, dto.getBottomChk1());
			ps.setInt(82, dto.getBottomChk2());
			ps.setInt(83, dto.getBottomChk3());
			ps.setInt(84, dto.getBottomChk4());
			ps.setInt(85, dto.getBottomChk5());
			ps.setInt(86, dto.getBottomChk6());
			ps.setInt(87, dto.getBottomChk7());
			/**********评分*****************/
			ps.setInt(88, (int)dto.getOutwardScore());
			ps.setInt(89, (int)dto.getEngineScore());
			ps.setInt(90, (int)dto.getPilotScore());
			ps.setInt(91, (int)dto.getStartScore());
			ps.setInt(92, (int)dto.getRunScore());
			ps.setInt(93, (int)dto.getBottomScore());
			
			ps.setInt(94, dto.getId());
			
			ps.executeUpdate();	
			

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
}
